<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Jetson Inference: CUDA</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NVLogo_2D.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Jetson Inference
   </div>
   <div id="projectbrief">DNN Vision Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('group__cuda.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">Modules</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">CUDA<div class="ingroups"><a class="el" href="group__util.html">Utilities Library (jetson-utils)</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>CUDA utilities and image processing kernels.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Modules</h2></td></tr>
<tr class="memitem:group__colormap"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__colormap.html">Color Mapping</a></td></tr>
<tr class="memdesc:group__colormap"><td class="mdescLeft">&#160;</td><td class="mdescRight">Defines various colormaps and color mapping functions. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__colorspace"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__colorspace.html">Color Conversion</a></td></tr>
<tr class="memdesc:group__colorspace"><td class="mdescLeft">&#160;</td><td class="mdescRight">Colorspace conversion functions for various YUV formats, RGB, BGR, Bayer, and grayscale. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__crop"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crop.html">Cropping</a></td></tr>
<tr class="memdesc:group__crop"><td class="mdescLeft">&#160;</td><td class="mdescRight">Crop an image to the specified region of interest (ROI). <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__drawing"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__drawing.html">Drawing</a></td></tr>
<tr class="memdesc:group__drawing"><td class="mdescLeft">&#160;</td><td class="mdescRight">Drawing basic 2D shapes using CUDA. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__cudaError"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html">Error Checking</a></td></tr>
<tr class="memdesc:group__cudaError"><td class="mdescLeft">&#160;</td><td class="mdescRight">Error checking and logging macros. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__cudaFont"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaFont.html">Fonts</a></td></tr>
<tr class="memdesc:group__cudaFont"><td class="mdescLeft">&#160;</td><td class="mdescRight">TTF font rasterization and image overlay rendering using CUDA. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__cudaMemory"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaMemory.html">Memory Management</a></td></tr>
<tr class="memdesc:group__cudaMemory"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocation of CUDA mapped zero-copy memory. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__normalization"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__normalization.html">Normalization</a></td></tr>
<tr class="memdesc:group__normalization"><td class="mdescLeft">&#160;</td><td class="mdescRight">Normalize the pixel intensities of an image between two ranges. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__overlay"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__overlay.html">Overlay</a></td></tr>
<tr class="memdesc:group__overlay"><td class="mdescLeft">&#160;</td><td class="mdescRight">Overlay images and vector shapes onto other images. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__cudaFilter"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaFilter.html">Pixel Filtering</a></td></tr>
<tr class="memdesc:group__cudaFilter"><td class="mdescLeft">&#160;</td><td class="mdescRight">CUDA device functions for sampling pixels with bilinear filtering. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__pointCloud"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__pointCloud.html">Point Cloud</a></td></tr>
<tr class="memdesc:group__pointCloud"><td class="mdescLeft">&#160;</td><td class="mdescRight">3D point cloud processing and visualization. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__resize"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__resize.html">Resize</a></td></tr>
<tr class="memdesc:group__resize"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rescale an image to a different resolution. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__warping"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__warping.html">Warping</a></td></tr>
<tr class="memdesc:group__warping"><td class="mdescLeft">&#160;</td><td class="mdescRight">Various image warps and matrix transforms. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga46df5cd83bb2b50cd45d429154a7699b"><td class="memItemLeft" align="right" valign="top">__device__ __host__ int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cuda.html#ga46df5cd83bb2b50cd45d429154a7699b">iDivUp</a> (int a, int b)</td></tr>
<tr class="memdesc:ga46df5cd83bb2b50cd45d429154a7699b"><td class="mdescLeft">&#160;</td><td class="mdescRight">If a / b has a remainder, round up.  <a href="group__cuda.html#ga46df5cd83bb2b50cd45d429154a7699b">More...</a><br /></td></tr>
<tr class="separator:ga46df5cd83bb2b50cd45d429154a7699b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>CUDA utilities and image processing kernels. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga46df5cd83bb2b50cd45d429154a7699b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga46df5cd83bb2b50cd45d429154a7699b">&#9670;&nbsp;</a></span>iDivUp()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">__device__ __host__ int iDivUp </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>If a / b has a remainder, round up. </p>
<p>This function is commonly using when launching CUDA kernels, to compute a grid size inclusive of the entire dataset if it's dimensions aren't evenly divisible by the block size.</p>
<p>For example:</p>
<p>const dim3 blockDim(8,8); const dim3 gridDim(iDivUp(imgWidth,blockDim.x), iDivUp(imgHeight,blockDim.y));</p>
<p>Then inside the CUDA kernel, there is typically a check that thread index is in-bounds.</p>
<p>Without the use of <a class="el" href="group__cuda.html#ga46df5cd83bb2b50cd45d429154a7699b" title="If a / b has a remainder, round up.">iDivUp()</a>, if the data dimensions weren't evenly divisible by the block size, parts of the data wouldn't be covered by the grid and not processed. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Tue Mar 28 2023 14:27:58 for Jetson Inference by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>
